package com.nowcoder.community.entity;

import org.apache.kafka.common.protocol.types.Field;

import java.util.HashMap;
import java.util.Map;

/**
 * @author AnYang
 * @Description 系统消息事件
 * @Version 1.0.0
 * @Date 2024/2/4
 */
public class Event {

    // 类别
    private String topic;

    // 谁的操作导致发送消息
    private int userId;

    // 实体类别（帖子、评论、用户）
    private int entityType;

    // 实体id
    private int entityId;

    // 实体作者
    private int entityUserId;

    // 或者可能存在其他类型数据
    // 本系统中为了跳转到详情页面，如果点赞、评论需要帖子id
    private Map<String, Object> data = new HashMap<>();

    public String getTopic() {
        return topic;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getUserId() {
        return userId;
    }

    public Event setUserId(int userId) {
        this.userId = userId;
        return this;
    }

    public int getEntityType() {
        return entityType;
    }

    public Event setEntityType(int entityType) {
        this.entityType = entityType;
        return this;
    }

    public int getEntityId() {
        return entityId;
    }

    public Event setEntityId(int entityId) {
        this.entityId = entityId;
        return this;
    }

    public int getEntityUserId() {
        return entityUserId;
    }

    public Event setEntityUserId(int entityUserId) {
        this.entityUserId = entityUserId;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public Event setData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }

}
